﻿<%@ Page Title="" Language="C#" MasterPageFile="~/glymb.Master" AutoEventWireup="true" CodeBehind="glsp.aspx.cs" Inherits="ShoppingWebSite.glsp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="css/ShopSite.css" rel="stylesheet" />
     <style>
         #Content{
            width:500px;
            margin:0px auto;
            padding-bottom:30px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div id="Content">
    <p>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="PId" DataSourceID="SqlDataSource1">
            <Columns>
                <asp:BoundField DataField="PId" HeaderText="商品数量" InsertVisible="False" ReadOnly="True" SortExpression="PId" />
                <asp:BoundField DataField="PTypeId" HeaderText="商品类别编号" SortExpression="PTypeId" />
                <asp:BoundField DataField="PSName" HeaderText="商品名字" SortExpression="PSName" />
                <asp:BoundField DataField="PPrice" HeaderText="商品价格" SortExpression="PPrice" />
                <asp:BoundField DataField="PImage" HeaderText="商品图片" SortExpression="PImage" />
                <asp:CommandField ShowEditButton="True" />
                <asp:CommandField ShowDeleteButton="True" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ShoppingDBConnectionString8 %>" DeleteCommand="DELETE FROM [Product] WHERE [PId] = @PId" InsertCommand="INSERT INTO [Product] ([PTypeId], [PSName], [PPrice], [PImage]) VALUES (@PTypeId, @PSName, @PPrice, @PImage)" SelectCommand="SELECT * FROM [Product]" UpdateCommand="UPDATE [Product] SET [PTypeId] = @PTypeId, [PSName] = @PSName, [PPrice] = @PPrice, [PImage] = @PImage WHERE [PId] = @PId">
            <DeleteParameters>
                <asp:Parameter Name="PId" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="PTypeId" Type="Int32" />
                <asp:Parameter Name="PSName" Type="String" />
                <asp:Parameter Name="PPrice" Type="Decimal" />
                <asp:Parameter Name="PImage" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="PTypeId" Type="Int32" />
                <asp:Parameter Name="PSName" Type="String" />
                <asp:Parameter Name="PPrice" Type="Decimal" />
                <asp:Parameter Name="PImage" Type="String" />
                <asp:Parameter Name="PId" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>

    </p>
        </div>
</asp:Content>
